from django.db import models

class Host(models.Model):
	class Meta:
		db_table = 'hosts'
	address = models.CharField(maxlength=16,blank=True)
	comm = models.CharField(maxlength=255,blank=True)
	name = models.CharField(maxlength=255,blank=True)
	state = models.CharField(maxlength=255,blank=True)
	info = models.CharField(maxlength=1024,blank=True)

	def __repr__(self):
		return self.address	
class Service(models.Model):
	class Meta:
		db_table  = 'services'
	host_id = models.ForeignKey(Host,db_column="host_id")
	port = models.IntegerField(blank=True)
	proto = models.CharField(maxlength=16, blank=True)
	state = models.CharField(maxlength=255, blank=True)
	name = models.CharField(maxlength=255, blank=True)
	info = models.CharField(maxlength=1024, blank=True)
	
	def __repr__(self):
		return "%s/%s" % (self.name, self.port)
class Configuration(models.Model):
	MSFTYPE_CHOICES = (
		('R', 'Remote'),
		('L', 'Local')
	)
	class Meta:
		db_table = "configuration"
	msfpath = models.CharField(maxlength=255,blank=True, null=True)
	msfaddr = models.IPAddressField(blank=True,null=True)
	msfport = models.PositiveIntegerField(blank=True,null=True)
	msftype = models.CharField(maxlength=1,choices=MSFTYPE_CHOICES)
	msfdb_login = models.CharField(maxlength=255)
	msfdb_pass  = models.CharField(maxlength=255)
	msfdb_host  = models.CharField(maxlength=255,default="localhost")
	msfdb_port  = models.PositiveIntegerField(default=5432)
	msfdb_name  = models.CharField(maxlength=128)
